/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package VIEW;

import BEANS.ComboItem;
import CONTROLLERS.ReturnsController;
import UTIL.InputValidator;
import java.awt.event.KeyEvent;
import javax.swing.JComboBox;
import javax.swing.JOptionPane;

/**
 *
 * @author RPhDsmbrana
 */
public class NewReturns extends javax.swing.JPanel {
    private static ReturnsController returnsController;
    /**
     * Creates new form NewReturns
     */
    public NewReturns() {
        try{
        initComponents();
        returnsController = new ReturnsController(defectiveProductsTable, 
                returnsTable, supplierComboBox, dateReturnedDateChooserCombo, 
                addButton, remarksTextArea, inputQuantityDialog, 
                quantitiyInputNameLabel, inputQuantityTotal, inputQuantityInput,
                supplierName , info, returnedTable, replacedTable,
                replacementInputQuantityDialog, returnedSupplierFilter,
                totalQuantityText, replacementQuantityInput, replacedSupplierText,
                dateReplacedDateChooser, replacedRemarksInput,  
                dateChooserCombo1, dateChooserCombo2, jTable3, editQty, addButton);
        returnsHistoryDialog.setLocationRelativeTo(null);
        returnStatustDialog.setLocationRelativeTo(null);
        returnsController.justDClickIt(defectiveProductsTable);
        returnsController.justDClickIt2(returnedTable);
        inputQuantityDialog.setLocationRelativeTo(null);
        editQuantity.setLocationRelativeTo(null);
        returnsController.filterReturnsSupplierComboBox();
        returnsController.filterReturnedSupplierComboBox();
        returnsController.updateReturnedTable();
        InputValidator.enabler(defectiveProductsTable, addButton);
        InputValidator.enabler(returnsTable, edit);
        InputValidator.enabler(returnsTable, delete);
        InputValidator.enabler2(returnsTable, clear);
        InputValidator.enabler2(returnsTable, jButton1);
        InputValidator.enabler(returnedTable, jButton8);
        InputValidator.enabler(replacedTable, jButton7);
        }catch(Exception e){
            
        }
    }
    
    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        returnsHistoryDialog = new javax.swing.JDialog();
        jLabel6 = new javax.swing.JLabel();
        jScrollPane3 = new javax.swing.JScrollPane();
        jTable3 = new javax.swing.JTable();
        dateChooserCombo1 = new datechooser.beans.DateChooserCombo();
        dateChooserCombo2 = new datechooser.beans.DateChooserCombo();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        returnStatustDialog = new javax.swing.JDialog();
        jButton6 = new javax.swing.JButton();
        inputQuantityDialog = new javax.swing.JDialog();
        jLabel11 = new javax.swing.JLabel();
        quantitiyInputNameLabel = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        inputQuantityTotal = new javax.swing.JLabel();
        inputQuantityInput = new javax.swing.JTextField();
        jButton3 = new javax.swing.JButton();
        jButton4 = new javax.swing.JButton();
        replacementInputQuantityDialog = new javax.swing.JDialog();
        jLabel17 = new javax.swing.JLabel();
        replacementQuantityInput = new javax.swing.JTextField();
        jButton9 = new javax.swing.JButton();
        jButton10 = new javax.swing.JButton();
        totalQuantityText = new javax.swing.JLabel();
        editQuantity = new javax.swing.JDialog();
        jLabel19 = new javax.swing.JLabel();
        editQty = new javax.swing.JTextField();
        jButton11 = new javax.swing.JButton();
        jButton12 = new javax.swing.JButton();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        defectiveProductsTable = new javax.swing.JTable();
        jButton1 = new javax.swing.JButton();
        jScrollPane2 = new javax.swing.JScrollPane();
        returnsTable = new javax.swing.JTable();
        jLabel2 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        supplierComboBox = new javax.swing.JComboBox<ComboItem>();
        jLabel4 = new javax.swing.JLabel();
        jScrollPane4 = new javax.swing.JScrollPane();
        remarksTextArea = new javax.swing.JTextArea();
        addButton = new javax.swing.JButton();
        jLabel5 = new javax.swing.JLabel();
        dateReturnedDateChooserCombo = new datechooser.beans.DateChooserCombo();
        jLabel14 = new javax.swing.JLabel();
        supplierName = new javax.swing.JLabel();
        jSeparator1 = new javax.swing.JSeparator();
        info = new javax.swing.JLabel();
        delete = new javax.swing.JButton();
        clear = new javax.swing.JButton();
        edit = new javax.swing.JButton();
        jPanel2 = new javax.swing.JPanel();
        jScrollPane5 = new javax.swing.JScrollPane();
        returnedTable = new javax.swing.JTable();
        jLabel10 = new javax.swing.JLabel();
        jScrollPane6 = new javax.swing.JScrollPane();
        replacedRemarksInput = new javax.swing.JTextArea();
        jLabel15 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        dateReplacedDateChooser = new datechooser.beans.DateChooserCombo();
        jButton7 = new javax.swing.JButton();
        jScrollPane7 = new javax.swing.JScrollPane();
        replacedTable = new javax.swing.JTable();
        jButton8 = new javax.swing.JButton();
        SupplierLabel = new javax.swing.JLabel();
        returnedSupplierFilter = new javax.swing.JComboBox<ComboItem>();
        jLabel18 = new javax.swing.JLabel();
        replacedSupplierText = new javax.swing.JLabel();
        jSeparator2 = new javax.swing.JSeparator();
        jLabel3 = new javax.swing.JLabel();
        jButton2 = new javax.swing.JButton();

        returnsHistoryDialog.setTitle("Return History");
        returnsHistoryDialog.setBounds(new java.awt.Rectangle(0, 0, 900, 600));
        returnsHistoryDialog.setModalityType(java.awt.Dialog.ModalityType.APPLICATION_MODAL);

        jLabel6.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
        jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel6.setText("Return History");

        jTable3.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jTable3.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Date", "Product Name", "Serial", "Quantity", "Remarks", "Supplier"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jTable3.setRowHeight(20);
        jScrollPane3.setViewportView(jTable3);

        dateChooserCombo1.setWeekStyle(datechooser.view.WeekDaysStyle.FULL);
        dateChooserCombo1.addSelectionChangedListener(new datechooser.events.SelectionChangedListener() {
            public void onSelectionChange(datechooser.events.SelectionChangedEvent evt) {
                dateChooserCombo1OnSelectionChange(evt);
            }
        });
        dateChooserCombo1.addCommitListener(new datechooser.events.CommitListener() {
            public void onCommit(datechooser.events.CommitEvent evt) {
                dateChooserCombo1OnCommit(evt);
            }
        });

        dateChooserCombo2.setWeekStyle(datechooser.view.WeekDaysStyle.FULL);
        dateChooserCombo2.addSelectionChangedListener(new datechooser.events.SelectionChangedListener() {
            public void onSelectionChange(datechooser.events.SelectionChangedEvent evt) {
                dateChooserCombo2OnSelectionChange(evt);
            }
        });
        dateChooserCombo2.addCommitListener(new datechooser.events.CommitListener() {
            public void onCommit(datechooser.events.CommitEvent evt) {
                dateChooserCombo2OnCommit(evt);
            }
        });

        jLabel7.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel7.setText("To:");

        jLabel8.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel8.setText("From:");

        javax.swing.GroupLayout returnsHistoryDialogLayout = new javax.swing.GroupLayout(returnsHistoryDialog.getContentPane());
        returnsHistoryDialog.getContentPane().setLayout(returnsHistoryDialogLayout);
        returnsHistoryDialogLayout.setHorizontalGroup(
            returnsHistoryDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(returnsHistoryDialogLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(returnsHistoryDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 880, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, returnsHistoryDialogLayout.createSequentialGroup()
                        .addComponent(jLabel8)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(dateChooserCombo1, javax.swing.GroupLayout.PREFERRED_SIZE, 168, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jLabel7)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(dateChooserCombo2, javax.swing.GroupLayout.PREFERRED_SIZE, 169, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        returnsHistoryDialogLayout.setVerticalGroup(
            returnsHistoryDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(returnsHistoryDialogLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel6)
                .addGap(15, 15, 15)
                .addGroup(returnsHistoryDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(dateChooserCombo1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(dateChooserCombo2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel8, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel7, javax.swing.GroupLayout.Alignment.TRAILING))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 508, Short.MAX_VALUE)
                .addContainerGap())
        );

        returnStatustDialog.setTitle("Returned Product Status");
        returnStatustDialog.setBounds(new java.awt.Rectangle(0, 0, 600, 400));

        jButton6.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jButton6.setText("Mark as Replaced");

        javax.swing.GroupLayout returnStatustDialogLayout = new javax.swing.GroupLayout(returnStatustDialog.getContentPane());
        returnStatustDialog.getContentPane().setLayout(returnStatustDialogLayout);
        returnStatustDialogLayout.setHorizontalGroup(
            returnStatustDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(returnStatustDialogLayout.createSequentialGroup()
                .addContainerGap(453, Short.MAX_VALUE)
                .addComponent(jButton6)
                .addContainerGap())
        );
        returnStatustDialogLayout.setVerticalGroup(
            returnStatustDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(returnStatustDialogLayout.createSequentialGroup()
                .addGap(315, 315, 315)
                .addComponent(jButton6)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        inputQuantityDialog.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        inputQuantityDialog.setTitle("Input Quantity");
        inputQuantityDialog.setBounds(new java.awt.Rectangle(0, 0, 320, 170));
        inputQuantityDialog.setModalityType(java.awt.Dialog.ModalityType.APPLICATION_MODAL);

        jLabel11.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel11.setText("Please input the quantity to return:");

        quantitiyInputNameLabel.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        quantitiyInputNameLabel.setText("jLabel12");

        jLabel12.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel12.setText("Defective Product:");

        jLabel13.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel13.setText("Quantity in store:");

        inputQuantityTotal.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        inputQuantityTotal.setText("jLabel14");

        inputQuantityInput.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        inputQuantityInput.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                inputQuantityInputActionPerformed(evt);
            }
        });
        inputQuantityInput.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                inputQuantityInputKeyPressed(evt);
            }
        });

        jButton3.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jButton3.setText("Cancel");
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });

        jButton4.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jButton4.setText("OK");
        jButton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton4ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout inputQuantityDialogLayout = new javax.swing.GroupLayout(inputQuantityDialog.getContentPane());
        inputQuantityDialog.getContentPane().setLayout(inputQuantityDialogLayout);
        inputQuantityDialogLayout.setHorizontalGroup(
            inputQuantityDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(inputQuantityDialogLayout.createSequentialGroup()
                .addContainerGap(12, Short.MAX_VALUE)
                .addGroup(inputQuantityDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(inputQuantityDialogLayout.createSequentialGroup()
                        .addGroup(inputQuantityDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel12)
                            .addComponent(jLabel13))
                        .addGap(18, 18, 18)
                        .addGroup(inputQuantityDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(inputQuantityTotal)
                            .addComponent(quantitiyInputNameLabel)))
                    .addGroup(inputQuantityDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addGroup(inputQuantityDialogLayout.createSequentialGroup()
                            .addComponent(jButton4)
                            .addGap(18, 18, 18)
                            .addComponent(jButton3))
                        .addGroup(inputQuantityDialogLayout.createSequentialGroup()
                            .addComponent(jLabel11)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(inputQuantityInput, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap(23, Short.MAX_VALUE))
        );
        inputQuantityDialogLayout.setVerticalGroup(
            inputQuantityDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(inputQuantityDialogLayout.createSequentialGroup()
                .addGap(13, 13, 13)
                .addGroup(inputQuantityDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(quantitiyInputNameLabel)
                    .addComponent(jLabel12))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(inputQuantityDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel13)
                    .addComponent(inputQuantityTotal))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(inputQuantityDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel11)
                    .addComponent(inputQuantityInput, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(inputQuantityDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton4)
                    .addComponent(jButton3))
                .addGap(0, 41, Short.MAX_VALUE))
        );

        replacementInputQuantityDialog.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        replacementInputQuantityDialog.setTitle("Input quantity");
        replacementInputQuantityDialog.setBounds(new java.awt.Rectangle(0, 0, 400, 130));
        replacementInputQuantityDialog.setModalityType(java.awt.Dialog.ModalityType.APPLICATION_MODAL);

        jLabel17.setText("Input quantity:");

        replacementQuantityInput.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                replacementQuantityInputActionPerformed(evt);
            }
        });
        replacementQuantityInput.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                replacementQuantityInputKeyReleased(evt);
            }
        });

        jButton9.setText("Cancel");
        jButton9.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton9ActionPerformed(evt);
            }
        });

        jButton10.setText("OK");
        jButton10.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton10ActionPerformed(evt);
            }
        });

        totalQuantityText.setText("The item has a total quantity of ");

        javax.swing.GroupLayout replacementInputQuantityDialogLayout = new javax.swing.GroupLayout(replacementInputQuantityDialog.getContentPane());
        replacementInputQuantityDialog.getContentPane().setLayout(replacementInputQuantityDialogLayout);
        replacementInputQuantityDialogLayout.setHorizontalGroup(
            replacementInputQuantityDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(replacementInputQuantityDialogLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(replacementInputQuantityDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, replacementInputQuantityDialogLayout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(jButton10)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButton9))
                    .addGroup(replacementInputQuantityDialogLayout.createSequentialGroup()
                        .addGroup(replacementInputQuantityDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(replacementInputQuantityDialogLayout.createSequentialGroup()
                                .addComponent(jLabel17)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(replacementQuantityInput, javax.swing.GroupLayout.PREFERRED_SIZE, 257, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(totalQuantityText))
                        .addGap(0, 0, Short.MAX_VALUE)))
                .addContainerGap())
        );
        replacementInputQuantityDialogLayout.setVerticalGroup(
            replacementInputQuantityDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(replacementInputQuantityDialogLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(totalQuantityText)
                .addGap(3, 3, 3)
                .addGroup(replacementInputQuantityDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel17)
                    .addComponent(replacementQuantityInput, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(replacementInputQuantityDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton9)
                    .addComponent(jButton10))
                .addContainerGap(28, Short.MAX_VALUE))
        );

        editQuantity.setTitle("Input Edit Quantity");
        editQuantity.setBounds(new java.awt.Rectangle(0, 0, 250, 130));
        editQuantity.setModalityType(java.awt.Dialog.ModalityType.APPLICATION_MODAL);

        jLabel19.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel19.setText("Input Quantity:");

        jButton11.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jButton11.setText("OK");
        jButton11.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton11ActionPerformed(evt);
            }
        });

        jButton12.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jButton12.setText("Cancel");
        jButton12.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton12ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout editQuantityLayout = new javax.swing.GroupLayout(editQuantity.getContentPane());
        editQuantity.getContentPane().setLayout(editQuantityLayout);
        editQuantityLayout.setHorizontalGroup(
            editQuantityLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(editQuantityLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(editQuantityLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(editQuantityLayout.createSequentialGroup()
                        .addGap(0, 74, Short.MAX_VALUE)
                        .addComponent(jButton11, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jButton12, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(editQuantityLayout.createSequentialGroup()
                        .addComponent(jLabel19)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(editQty)))
                .addContainerGap())
        );
        editQuantityLayout.setVerticalGroup(
            editQuantityLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(editQuantityLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(editQuantityLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel19)
                    .addComponent(editQty, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(editQuantityLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton11)
                    .addComponent(jButton12))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        setBackground(new java.awt.Color(204, 204, 204));
        setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jLabel1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel1.setText("Products Selected");
        jPanel1.add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(520, 80, -1, -1));

        defectiveProductsTable.setAutoCreateRowSorter(true);
        defectiveProductsTable.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        defectiveProductsTable.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Return_id", "Date Replaced", "Product Name", "Supplier", "Serial Number", "Quantity", "Remarks"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        defectiveProductsTable.setRowHeight(20);
        defectiveProductsTable.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                defectiveProductsTableKeyPressed(evt);
            }
        });
        jScrollPane1.setViewportView(defectiveProductsTable);

        jPanel1.add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 51, 470, 480));

        jButton1.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jButton1.setText("Return to Supplier");
        jButton1.setEnabled(false);
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });
        jPanel1.add(jButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(880, 540, -1, -1));

        returnsTable.setAutoCreateRowSorter(true);
        returnsTable.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        returnsTable.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Return_id", "Product Name", "Serial Number", "Quantity", "Remarks", "totalQuantity"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false, false, true, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        returnsTable.setRowHeight(20);
        jScrollPane2.setViewportView(returnsTable);

        jPanel1.add(jScrollPane2, new org.netbeans.lib.awtextra.AbsoluteConstraints(520, 108, 520, 350));

        jLabel2.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel2.setText("Defective Products in Store");
        jPanel1.add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 20, -1, -1));

        jLabel9.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel9.setText("Supplier:");
        jPanel1.add(jLabel9, new org.netbeans.lib.awtextra.AbsoluteConstraints(250, 20, -1, -1));

        supplierComboBox.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        supplierComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "All" }));
        supplierComboBox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                supplierComboBoxActionPerformed(evt);
            }
        });
        supplierComboBox.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                supplierComboBoxPropertyChange(evt);
            }
        });
        jPanel1.add(supplierComboBox, new org.netbeans.lib.awtextra.AbsoluteConstraints(310, 20, 170, -1));

        jLabel4.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel4.setText("Remarks:");
        jPanel1.add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(520, 460, -1, -1));

        remarksTextArea.setColumns(20);
        remarksTextArea.setRows(5);
        jScrollPane4.setViewportView(remarksTextArea);

        jPanel1.add(jScrollPane4, new org.netbeans.lib.awtextra.AbsoluteConstraints(520, 480, 520, 50));

        addButton.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        addButton.setText("Add");
        addButton.setAutoscrolls(true);
        addButton.setEnabled(false);
        addButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addButtonActionPerformed(evt);
            }
        });
        jPanel1.add(addButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(420, 540, -1, -1));

        jLabel5.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel5.setText("Date Returned:");
        jPanel1.add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(520, 20, -1, -1));

        dateReturnedDateChooserCombo.setFormat(0);
        jPanel1.add(dateReturnedDateChooserCombo, new org.netbeans.lib.awtextra.AbsoluteConstraints(620, 20, 190, -1));

        jLabel14.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel14.setText("Supplier:");
        jPanel1.add(jLabel14, new org.netbeans.lib.awtextra.AbsoluteConstraints(520, 50, -1, 20));

        supplierName.setText(" ");
        jPanel1.add(supplierName, new org.netbeans.lib.awtextra.AbsoluteConstraints(580, 50, 230, 20));

        jSeparator1.setOrientation(javax.swing.SwingConstants.VERTICAL);
        jPanel1.add(jSeparator1, new org.netbeans.lib.awtextra.AbsoluteConstraints(500, 1, 40, 600));
        jPanel1.add(info, new org.netbeans.lib.awtextra.AbsoluteConstraints(392, 571, -1, 20));

        delete.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        delete.setText("Delete");
        delete.setEnabled(false);
        delete.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                deleteActionPerformed(evt);
            }
        });
        jPanel1.add(delete, new org.netbeans.lib.awtextra.AbsoluteConstraints(880, 80, -1, -1));

        clear.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        clear.setText("Clear All");
        clear.setEnabled(false);
        clear.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                clearActionPerformed(evt);
            }
        });
        jPanel1.add(clear, new org.netbeans.lib.awtextra.AbsoluteConstraints(960, 80, -1, -1));

        edit.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        edit.setText("Edit Quantity");
        edit.setEnabled(false);
        edit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                editActionPerformed(evt);
            }
        });
        jPanel1.add(edit, new org.netbeans.lib.awtextra.AbsoluteConstraints(760, 80, -1, -1));

        jTabbedPane1.addTab("Returns", jPanel1);

        jPanel2.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        returnedTable.setAutoCreateRowSorter(true);
        returnedTable.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Return_id", "Return Date", "Product Name", "Supplier", "Quantity"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        returnedTable.setRowHeight(20);
        jScrollPane5.setViewportView(returnedTable);

        jPanel2.add(jScrollPane5, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 59, 524, 462));

        jLabel10.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel10.setText("Incoming Products for Replacement of Returned Defective Products:");
        jPanel2.add(jLabel10, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 0, 444, 22));

        replacedRemarksInput.setColumns(20);
        replacedRemarksInput.setRows(5);
        jScrollPane6.setViewportView(replacedRemarksInput);

        jPanel2.add(jScrollPane6, new org.netbeans.lib.awtextra.AbsoluteConstraints(556, 463, 500, 58));

        jLabel15.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel15.setText("Remarks:");
        jPanel2.add(jLabel15, new org.netbeans.lib.awtextra.AbsoluteConstraints(556, 440, -1, -1));

        jLabel16.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel16.setText("Date Replaced By Supplier:");
        jPanel2.add(jLabel16, new org.netbeans.lib.awtextra.AbsoluteConstraints(556, 30, -1, -1));
        jPanel2.add(dateReplacedDateChooser, new org.netbeans.lib.awtextra.AbsoluteConstraints(739, 28, 205, -1));

        jButton7.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jButton7.setText("Mark as Replaced By Supplier");
        jButton7.setEnabled(false);
        jButton7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton7ActionPerformed(evt);
            }
        });
        jPanel2.add(jButton7, new org.netbeans.lib.awtextra.AbsoluteConstraints(823, 527, -1, -1));

        replacedTable.setAutoCreateRowSorter(true);
        replacedTable.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Return_id", "Product Name", "Supplier", "Quantity", "totalQuantity"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jScrollPane7.setViewportView(replacedTable);

        jPanel2.add(jScrollPane7, new org.netbeans.lib.awtextra.AbsoluteConstraints(556, 96, 500, 338));

        jButton8.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jButton8.setText("Add");
        jButton8.setEnabled(false);
        jButton8.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton8ActionPerformed(evt);
            }
        });
        jPanel2.add(jButton8, new org.netbeans.lib.awtextra.AbsoluteConstraints(455, 527, 79, -1));

        SupplierLabel.setText("Supplier");
        jPanel2.add(SupplierLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(320, 30, -1, 25));

        returnedSupplierFilter.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        returnedSupplierFilter.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                returnedSupplierFilterActionPerformed(evt);
            }
        });
        jPanel2.add(returnedSupplierFilter, new org.netbeans.lib.awtextra.AbsoluteConstraints(376, 30, 158, -1));

        jLabel18.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jLabel18.setText("Supplier:");
        jPanel2.add(jLabel18, new org.netbeans.lib.awtextra.AbsoluteConstraints(556, 59, -1, -1));

        replacedSupplierText.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        replacedSupplierText.setText("jLabel19");
        jPanel2.add(replacedSupplierText, new org.netbeans.lib.awtextra.AbsoluteConstraints(619, 59, -1, -1));

        jSeparator2.setOrientation(javax.swing.SwingConstants.VERTICAL);
        jPanel2.add(jSeparator2, new org.netbeans.lib.awtextra.AbsoluteConstraints(546, 0, 50, 590));

        jTabbedPane1.addTab("Return Products", jPanel2);

        add(jTabbedPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 50, -1, 621));

        jLabel3.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
        jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel3.setText("Returns");
        add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(14, 10, 1070, 30));

        jButton2.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        jButton2.setText("View Returns History");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });
        add(jButton2, new org.netbeans.lib.awtextra.AbsoluteConstraints(920, 10, -1, -1));
    }// </editor-fold>//GEN-END:initComponents

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        returnsController.updateReturnsHistory();
        returnsHistoryDialog.setVisible(true);
    }//GEN-LAST:event_jButton2ActionPerformed

    private void addButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addButtonActionPerformed
        returnsController.addToReturnsTable();
        InputValidator.enabler(defectiveProductsTable, addButton);
        InputValidator.enabler(returnsTable, edit);
        InputValidator.enabler(returnsTable, delete);
        InputValidator.enabler2(returnsTable, clear);
        InputValidator.enabler2(returnsTable, jButton1);
    }//GEN-LAST:event_addButtonActionPerformed

    private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
        returnsController.addPartialToReturnsTable();
        InputValidator.enabler(defectiveProductsTable, addButton);
        InputValidator.enabler(returnsTable, edit);
        InputValidator.enabler(returnsTable, delete);
        InputValidator.enabler2(returnsTable, clear);
        InputValidator.enabler2(returnsTable, jButton1);
        InputValidator.enabler2(replacedTable, jButton7);
    }//GEN-LAST:event_jButton4ActionPerformed

    private void inputQuantityInputActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_inputQuantityInputActionPerformed
                // TODO add your handling code here:
    }//GEN-LAST:event_inputQuantityInputActionPerformed

    private void supplierComboBoxPropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_supplierComboBoxPropertyChange
        //returnsController.updateReturnsTable();
    }//GEN-LAST:event_supplierComboBoxPropertyChange

    private void supplierComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_supplierComboBoxActionPerformed
        returnsController.changeSupplier();
    }//GEN-LAST:event_supplierComboBoxActionPerformed

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
        inputQuantityDialog.dispose();
    }//GEN-LAST:event_jButton3ActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        returnsController.returnToSupplier();
        InputValidator.enabler(defectiveProductsTable, addButton);
        InputValidator.enabler(returnsTable, edit);
        InputValidator.enabler(returnsTable, delete);
        InputValidator.enabler2(returnsTable, clear);
        InputValidator.enabler2(returnsTable, jButton1);
    }//GEN-LAST:event_jButton1ActionPerformed

    private void inputQuantityInputKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_inputQuantityInputKeyPressed
        if (evt.getKeyCode()== KeyEvent.VK_ENTER)
	{
            jButton4.doClick();
	}    
    }//GEN-LAST:event_inputQuantityInputKeyPressed

    private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton8ActionPerformed
        returnsController.checkIfMultiple();
        InputValidator.enabler2(replacedTable, jButton7);
    }//GEN-LAST:event_jButton8ActionPerformed

    private void jButton10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton10ActionPerformed
        returnsController.addToReplacedTable();
        InputValidator.enabler(defectiveProductsTable, addButton);
        InputValidator.enabler(returnsTable, edit);
        InputValidator.enabler(returnsTable, delete);
        InputValidator.enabler2(returnsTable, clear);
        InputValidator.enabler2(returnsTable, jButton1);
        InputValidator.enabler2(replacedTable, jButton7);
    }//GEN-LAST:event_jButton10ActionPerformed

    private void returnedSupplierFilterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_returnedSupplierFilterActionPerformed
        returnsController.changeSupplierReturnedTable();
    }//GEN-LAST:event_returnedSupplierFilterActionPerformed

    private void replacementQuantityInputActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_replacementQuantityInputActionPerformed
 
    }//GEN-LAST:event_replacementQuantityInputActionPerformed

    private void replacementQuantityInputKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_replacementQuantityInputKeyReleased
        if (evt.getKeyCode()== KeyEvent.VK_ENTER)
	{
            jButton10.doClick();
	}    
    }//GEN-LAST:event_replacementQuantityInputKeyReleased

    private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed
        returnsController.markAsReplacedBySupplier();
    }//GEN-LAST:event_jButton7ActionPerformed

    private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton9ActionPerformed
        replacementInputQuantityDialog.dispose();
    }//GEN-LAST:event_jButton9ActionPerformed

    private void dateChooserCombo1OnSelectionChange(datechooser.events.SelectionChangedEvent evt) {//GEN-FIRST:event_dateChooserCombo1OnSelectionChange
        returnsController.updateReturnsHistory();
    }//GEN-LAST:event_dateChooserCombo1OnSelectionChange

    private void dateChooserCombo2OnSelectionChange(datechooser.events.SelectionChangedEvent evt) {//GEN-FIRST:event_dateChooserCombo2OnSelectionChange
        returnsController.updateReturnsHistory();
    }//GEN-LAST:event_dateChooserCombo2OnSelectionChange

    private void dateChooserCombo1OnCommit(datechooser.events.CommitEvent evt) {//GEN-FIRST:event_dateChooserCombo1OnCommit
        returnsController.updateReturnsHistory();
    }//GEN-LAST:event_dateChooserCombo1OnCommit

    private void dateChooserCombo2OnCommit(datechooser.events.CommitEvent evt) {//GEN-FIRST:event_dateChooserCombo2OnCommit
        returnsController.updateReturnsHistory();
        InputValidator.enabler(returnsTable, delete);
        InputValidator.enabler(returnsTable, edit);
        InputValidator.enabler2(returnsTable, clear);
    }//GEN-LAST:event_dateChooserCombo2OnCommit

    private void deleteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteActionPerformed
        returnsController.removeSelectedRow();
        InputValidator.enabler(defectiveProductsTable, addButton);
        InputValidator.enabler(returnsTable, edit);
        InputValidator.enabler(returnsTable, delete);
        InputValidator.enabler2(returnsTable, clear);
        InputValidator.enabler2(returnsTable, jButton1);
        
    }//GEN-LAST:event_deleteActionPerformed

    private void clearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_clearActionPerformed
        returnsController.clearList();
        InputValidator.enabler(defectiveProductsTable, addButton);
        InputValidator.enabler(returnsTable, edit);
        InputValidator.enabler(returnsTable, delete);
        InputValidator.enabler2(returnsTable, clear);
        InputValidator.enabler2(returnsTable, jButton1);
    }//GEN-LAST:event_clearActionPerformed

    private void defectiveProductsTableKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_defectiveProductsTableKeyPressed
        if (evt.getKeyCode()==KeyEvent.VK_ENTER){
            inputQuantityDialog.setVisible(true);
        }
    }//GEN-LAST:event_defectiveProductsTableKeyPressed

    private void editActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editActionPerformed
        editQuantity.setVisible(true);
        InputValidator.enabler(defectiveProductsTable, addButton);
        InputValidator.enabler(returnsTable, edit);
        InputValidator.enabler(returnsTable, delete);
        InputValidator.enabler2(returnsTable, clear);
        InputValidator.enabler2(returnsTable, jButton1);
    }//GEN-LAST:event_editActionPerformed

    private void jButton12ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton12ActionPerformed
        editQuantity.dispose();
    }//GEN-LAST:event_jButton12ActionPerformed

    private void jButton11ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton11ActionPerformed
        editQuantity.dispose();
        InputValidator.enabler(defectiveProductsTable, addButton);
        InputValidator.enabler(returnsTable, edit);
        InputValidator.enabler(returnsTable, delete);
        InputValidator.enabler2(returnsTable, clear);
        InputValidator.enabler2(returnsTable, jButton1);
    }//GEN-LAST:event_jButton11ActionPerformed

    public static JComboBox<ComboItem> getSupplierComboBox(){
        return supplierComboBox;
    }

    public static void updateDefectiveItemsTable(){
        returnsController.updateReturnsTable();
    }
    
    
    
    public static void updateReturnedTable(){
        returnsController.updateReturnedTable();
    }
    
    public static void filterComboBox(){
        returnsController.filterReturnsSupplierComboBox();
    }
     
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel SupplierLabel;
    private javax.swing.JButton addButton;
    private javax.swing.JButton clear;
    private datechooser.beans.DateChooserCombo dateChooserCombo1;
    private datechooser.beans.DateChooserCombo dateChooserCombo2;
    private datechooser.beans.DateChooserCombo dateReplacedDateChooser;
    private datechooser.beans.DateChooserCombo dateReturnedDateChooserCombo;
    private javax.swing.JTable defectiveProductsTable;
    private javax.swing.JButton delete;
    private javax.swing.JButton edit;
    private javax.swing.JTextField editQty;
    private javax.swing.JDialog editQuantity;
    private javax.swing.JLabel info;
    private javax.swing.JDialog inputQuantityDialog;
    private javax.swing.JTextField inputQuantityInput;
    private javax.swing.JLabel inputQuantityTotal;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton10;
    private javax.swing.JButton jButton11;
    private javax.swing.JButton jButton12;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JButton jButton6;
    private javax.swing.JButton jButton7;
    private javax.swing.JButton jButton8;
    private javax.swing.JButton jButton9;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JScrollPane jScrollPane6;
    private javax.swing.JScrollPane jScrollPane7;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTable jTable3;
    private javax.swing.JLabel quantitiyInputNameLabel;
    private javax.swing.JTextArea remarksTextArea;
    private javax.swing.JTextArea replacedRemarksInput;
    private javax.swing.JLabel replacedSupplierText;
    private javax.swing.JTable replacedTable;
    private javax.swing.JDialog replacementInputQuantityDialog;
    private javax.swing.JTextField replacementQuantityInput;
    private javax.swing.JDialog returnStatustDialog;
    private javax.swing.JComboBox<ComboItem> returnedSupplierFilter;
    private javax.swing.JTable returnedTable;
    private javax.swing.JDialog returnsHistoryDialog;
    private javax.swing.JTable returnsTable;
    private static javax.swing.JComboBox<ComboItem> supplierComboBox;
    private javax.swing.JLabel supplierName;
    private javax.swing.JLabel totalQuantityText;
    // End of variables declaration//GEN-END:variables
}
